﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Home_Search : System.Web.UI.Page
{
    public LanguageManage Language;
    UserEntity currentUser;
    BookAdapter bookAdap;
    CategoryAdapter cateAdap;
    PlatformAdapter platAdpap;
    public int idSearch=0;
    protected void Page_Load(object sender, EventArgs e)
    {
        //Check Login
        currentUser = UserManager.Instance.Getuser();
        if (!currentUser.isLogin)
            Response.Redirect("~/Login.aspx");
        Language = new LanguageManage();
        if (Session["keysearch"] != null)
        {
            idSearch =int.Parse(Session["conditionsearch"].ToString());
            if (idSearch == 3)
            {
                bookAdap = new BookAdapter();
                ListBook1.listBook = bookAdap.searchBook((string)Session["keysearch"], currentUser);
            }
            else if (idSearch == 1)
            {
                cateAdap = new CategoryAdapter();
                ListCategory1.listCategory = cateAdap.searchCategories((string)Session["keysearch"]);
            }
            else
            {
                platAdpap = new PlatformAdapter();
                Platform1.platforms = platAdpap.searchPlatform((string)Session["keysearch"]);
            }
            
        }
        Session["menu_id"] = null;
    }
}
